<?php

use think\migration\Migrator;
use think\migration\db\Column;

class UserCaravanCalendars extends Migrator
{
    public function up()
    {
        $users = $this->table('user_caravan_calendar', array('comment' => '会员房车详细日历状态表'));
        $users->addColumn('user_id', 'integer', array('comment' => '房车所属会员id'))
              ->addColumn('caravan_id', 'integer', array('comment' => '房车id'))
              ->addColumn('camps_id', 'integer', array('limit' => 3, 'comment' => '所属营地id'))
              ->addColumn('is_holiday', 'integer', array('limit' => 2, 'default' => 1))
              ->addColumn('shares', 'integer', array('limit' => 1, 'default' => 0, 'comment' => '是否分享状态'))
              ->addColumn('trusts', 'integer', array('limit' => 1, 'default' => 0, 'comment' => '是否托管状态'))
              ->addColumn('locks', 'integer', array('limit' => 1, 'default' => 0, 'comment' => '是否锁定状态'))
              ->addColumn('orders', 'integer', array('limit' => 1, 'default' => 0, 'comment' => '是否订单状态'))
              ->addColumn('single_day_coin', 'integer', array('comment' => '单日旅行币', 'null' => true))
              ->addColumn('single_day_price', 'integer', array('comment' => '单日托管价格', 'null' => true))
              ->addColumn('datetimes', 'date', array('comment' => '日期'))
              ->addColumn('created_at', 'timestamp', array('null' => true))
              ->addColumn('updated_at', 'timestamp', array('null' => true))
              ->addIndex('caravan_id')
              ->save();     
    }

    /**
     * Migrate Down.
     */
    public function down()
    {
        $this->dropTable('user_caravan_calendar');
    }
}
